//
//  Leve3Layer.m
//  mmtouch
//
//  Created by xing lion on 11-9-7.
//  Copyright 2011年 tencent. All rights reserved.
//

#import "Leve3Layer.h"
#import "PlayLayer.h"
#import "SceneManager.h"

@implementation Leve3Layer


-(void)gotoPlay:(id)sender
{
    
    int picnum = [sender tag];
    
	CCLayer *layer = [PlayLayer node];
    [(PlayLayer*)layer gotonextMM :picnum];
	[SceneManager go: layer];
}


-(void)makebutton1
{
    
    CCSprite* menupic = [CCSprite spriteWithFile:@"81.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen1 setTag:81];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"82.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen2 setTag:82];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"83.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen3 setTag:83];
    
    CCSprite* menupic4 = [CCSprite spriteWithFile:@"84.png"];
    
    CCMenuItemSprite *spmen4 = [CCMenuItemSprite itemFromNormalSprite:menupic4 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen4 setTag:84];
    CCSprite* menupic5 = [CCSprite spriteWithFile:@"85.png"];
    
    CCMenuItemSprite *spmen5 = [CCMenuItemSprite itemFromNormalSprite:menupic5 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen5 setTag:85];
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,spmen4,spmen5, nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 450)];
    
    [self addChild:menu];
    
}

-(void)makebutton2
{
    
    
    CCSprite* menupic = [CCSprite spriteWithFile:@"86.png"];
    
    CCMenuItemSprite *spmen1 = [CCMenuItemSprite itemFromNormalSprite:menupic selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen1 setTag:86];
    
    CCSprite* menupic2 = [CCSprite spriteWithFile:@"87.png"];
    
    CCMenuItemSprite *spmen2 = [CCMenuItemSprite itemFromNormalSprite:menupic2 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
    
     [spmen2 setTag:87];
    
    CCSprite* menupic3 = [CCSprite spriteWithFile:@"88.png"];
    
    CCMenuItemSprite *spmen3 = [CCMenuItemSprite itemFromNormalSprite:menupic3 selectedSprite:nil target:self selector:@selector(gotoPlay:)];
   [spmen3 setTag:88];
    
    
    CCMenu* menu = [CCMenu menuWithItems:spmen1,spmen2,spmen3,nil];
    
    
    [menu alignItemsHorizontallyWithPadding:10];
    
    [menu setPosition:ccp(160, 390)];
    
    [self addChild:menu];
}



- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
        //        
        //        CCSprite* sp = [CCSprite spriteWithFile:@"1.jpg"];
        //        
        //        sp.position = ccp(160, 240);
        //        
        //        [self addChild:sp];
        
        [self makebutton1];
        [self makebutton2];
 
        
        
    }
    
    return self;
}


@end
